package com.ruoyi.tzzl.service.imp;

import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.tzzl.domain.WzAdvertising;
import com.ruoyi.tzzl.mapper.WzAdvertisingMapper;
import com.ruoyi.tzzl.service.IWzAdvertisingService;
import org.springframework.stereotype.Service;

/**
 * 广告配置Service业务层处理
 * @author by caoyong
 * @date 2022/11/17
 **/
@Service
public class WzAdvertisingServiceImpl extends ServiceImpl<WzAdvertisingMapper, WzAdvertising> implements IWzAdvertisingService {


    @Override
    public boolean update(WzAdvertising wzAdvertising) {
        WzAdvertising wzAdvertising1 =this.getById(wzAdvertising.getId());
        //弹框背景图
        if (ObjectUtils.isNotEmpty(wzAdvertising.getBouncedBackgroundUrl())){
            wzAdvertising1.setBouncedBackgroundUrl(wzAdvertising.getBouncedBackgroundUrl());
        }
        //红娘联盟群海报图
        if (ObjectUtils.isNotEmpty(wzAdvertising.getGroupBackgroundUrl())){
            wzAdvertising1.setGroupBackgroundUrl(wzAdvertising.getGroupBackgroundUrl());
        }
        //海报背景图
        if (ObjectUtils.isNotEmpty(wzAdvertising.getPostersBackgroundUrl())){
            wzAdvertising1.setPostersBackgroundUrl(wzAdvertising.getPostersBackgroundUrl());
        }
        //轮播图
        if (ObjectUtils.isNotEmpty(wzAdvertising.getSlideshowBackgroundUrl())){
            wzAdvertising1.setSlideshowBackgroundUrl(wzAdvertising.getSlideshowBackgroundUrl());
        }
        return this.updateById(wzAdvertising1);
    }
}
